
function $$( selector ) {
  if(selector.indexOf('.') > 0) //this might be a css class
    return document.getElementsByClassName(selector);
  else if(selector.indexOf('#') > 0) // this might be an id
    return document.getElementById(selector);
  else //this might be a tag name
    return document.getElementsByTagName(selector);
    //this is not taking all the different cases into account, but you get the idea.
};